import { request } from "@umijs/max";;
import { UMS_REQUEST_PREFIX } from "@/utils/config";
import { lineBatchTypes, lineTypes, lineQuoteTypes, orderTypes, addressTypes, bookingTypes } from "@/constants/types";

// 订单管理
/**
 * 获取意向单
 * @returns 
 */
export async function fetchIntendedOrderList(params:any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/intendedOrder/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 获取意向单tab num
 * @returns 
 */
export async function fetchPreOrderTabNum(params:any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/intendedOrder/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 获取意向单详情
 * @returns 
 */
export async function fetchPreOrderDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/intendedOrder/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 意向单是否能转订单
 * @returns 
 */
export async function intendedOrdertransformOrder(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/intendedOrder/transformOrder`, {
    method: 'POST',
    data: params
  });
}
/**
 * 订单列表
 * @returns 
 */
export async function fetchOrderList(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单列表
 * @returns 
 */
export async function fetchOrderDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单Tab
 * @returns 
 */
export async function fetchOrderTabNum(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 优惠券列表
 * @returns 
 */
export async function fetchOrderSelectCoupon(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/selectCoupon`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 下单
 * @returns 
 */
export async function placeOrder(params: orderTypes) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/placeOrder`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 导出唛头
 * @returns 
 */
export async function orderExportMt(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/exportMt`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 导入订单轨迹
 * @returns 
 */
export async function orderImportTracks(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/importTracks`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 订单内部轨迹
 * @returns 
 */
export async function fetchOrderTracks(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/tracks`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单客户轨迹列表
 * @returns 
 */
export async function fetchOrderCustTracks(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/custTracks`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 导入委托单
 * @returns 
 */
export async function orderImportEntrust(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/uploadEntrustFile`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 订单取消
 * @returns 
 */
export async function orderCancel(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/cancel`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 订单审核列表
 * @returns 
 */
export async function fetchOrderCheckRecordList(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/orderCheckRecord/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单TAB NUM
 * @returns 
 */
export async function fetchOrderCheckRecordTabNum(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/orderCheckRecord/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单详情
 * @returns 
 */
export async function fetchOrderCheckRecordDetail(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/orderCheckRecord/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单计算金额
 * @returns 
 */
export async function orderCalcOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/calcOrder`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 附件列表
 * @returns 
 */
export async function fetchOrderAttachments(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/attachments`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 审核订单
 * @returns 
 */
export async function orderCheckRecordCheckOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/orderCheckRecord/checkOrder`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 查询报价
 * @returns 
 */
export async function queryLineQuote(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/lps/lineQuote/queryQuote`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 目的地下拉列表
 * @returns 
 */
export async function fetchDestinationOptions(params: {destType: string | undefined, country: string | undefined}) {
  return request(`${UMS_REQUEST_PREFIX}/base/destination/options`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 客户下拉列表
 * @returns 
 */
export async function fetchCustomerOptions(params: {customerName?: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/options`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 下单手机列表
 * @returns 
 */
export async function fetchCustomerStaffsList(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/staffsList`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 员工客户下拉列表
 * @returns 
 */
export async function fetchCustomerStaffsOptions(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/crm/customer/staffsOptions`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}

/**
 * 提货地址列表
 * @returns 
 */
export async function fetchUserPickupAddressList(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 提货地址详情
 * @returns 
 */
export async function fetchUserPickupAddressDetail(params: addressTypes) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 新增提货地址
 * @returns 
 */
export async function userPickupAddressAdd(params: addressTypes) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/add`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 新增提货地址
 * @returns 
 */
export async function userPickupAddressUpdate(params: addressTypes) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/update`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 删除提货地址
 * @returns 
 */
export async function userPickupAddressDelete(params: addressTypes) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/delete`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 设置默认提货地址
 * @returns 
 */
export async function userPickupAddressSetDefault(params: addressTypes) {
  return request(`${UMS_REQUEST_PREFIX}/sso/userPickupAddress/setDefault`, {
    method: 'POST',
    data: params,
  });
}
// 柜子
/**
 * 柜子列表
 * @returns 
 */
export async function fetchBookingList(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/list`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 柜子TAB
 * @returns 
 */
export async function fetchBookingTabNum(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/tabNum`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 开柜
 * @returns 
 */
export async function bookingAdd(params: bookingTypes) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/add`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 编辑开柜
 * @returns 
 */
export async function bookingUpdate(params: bookingTypes) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/update`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 柜子详情
 * @returns 
 */
export async function fetchBookingDetail(params: {id: string | null}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/detail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 柜子订单列表
 * @returns 
 */
export async function fetchBookingListOrders(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/listOrders`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 打标
 * @returns 
 */
export async function bookingTag(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/bookingTag`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 移入订单
 * @returns 
 */
export async function bookingMoveOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/moveOrder`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 移出订单
 * @returns 
 */
export async function bookingRemoveOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/booking/removeOrder`, {
    method: 'POST',
    data: params,
  });
}
// 入仓
/**
 * 导入仓数据
 * @returns 
 */
export async function importReceiptData(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/importReceiptData`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 导出入仓核实单预览
 * @returns 
 */
export async function exportInWhDataPreview(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/exportInWhDataPreview`, {
    method: 'POST',
    data: params,
    dataField: 'data',
  });
}
/**
 * 导出入仓数据
 * @returns 
 */
export async function exportInWhData(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/exportInWhData`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 导出单个入仓数据
 * @returns 
 */
export async function exportInWhDataSingle(params: {id: string}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/exportInWhDataSingle`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 入仓核实数据
 * @returns 
 */
export async function inWhVerifyData(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/inWhVerifyData`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 更新入仓核实数据
 * @returns 
 */
export async function confirmOrderInWhData(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/confirmOrderInWhData`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 确认入仓核实数据
 * @returns 
 */
export async function confirmOrderInWhVerifyData(params: {ids: string []}) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/confirmOrderInWhVerifyData`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 计算入仓核实数据
 * @returns 
 */
export async function calcInWhVerifyData(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/calcInWhVerifyData`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单入仓数据
 * @returns 
 */
export async function receiptDetail(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/receiptDetail`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 订单下拉列表
 * @returns 
 */
export async function fetchOrderOptions(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/options`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 标记约车
 * @returns 
 */
export async function markBookingCar(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/markBookingCar`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 标记到仓
 * @returns 
 */
export async function markArriveDomesticWh(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/markArriveDomesticWh`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 标记派送
 * @returns 
 */
export async function markDelivery(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/markDelivery`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 标记签收
 * @returns 
 */
export async function markSign(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/markSign`, {
    method: 'POST',
    data: params,
  });
}
/**
 * 订单收货数据
 * @returns 
 */
export async function orderReceiptOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/receiptOrder`, {
    method: 'POST',
    data: params,
    dataField: 'data'
  });
}
/**
 * 更新收货数据
 * @returns 
 */
export async function orderUpdateReceiptOrder(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/oms/order/updateReceiptOrder`, {
    method: 'POST',
    data: params,
  });
}